<template>
  <div id="app">
    姓名: <input type="text" v-model="msg"><br><br>
    年龄: <input type="number" v-model.number="age"><br><br>
    身高: <input type="number" v-model.number="shengao"><br><br>
    体重: <input type="number" v-model.number="weight"><br><br>
    病史: <input type="text" v-model="history"><br><br>
    <button @click="btn">诊断</button><br><br>
    {{returnMsg }}
  </div>
</template>

<script>
export default {
  data() {
    return {
      msg: '',
      age:'',
      shengao:'',
      weight:'',
      history:'',
      returnMsg:''
    }
  },
  methods: {
    btn(){
      const BMI = this.weight/this.shengao*this.shengao
      let res = ''
      if(BMI<=18.5){
        res='体重过轻'
      }else if(BMI<=24.9) {
        res = '正常'
      }else if(BMI<=29.9) {
        res = '体重过重'
      }else {
        res = '肥胖'
      }
      this.returnMsg= '患者'+this.msg+'的诊断结果:'+res
    }
	}
}
</script>

<style>

</style>